﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="TabsAddingPage.aspx.cs" Inherits="EvaluationSystem.ConfigurationPages.TabsPages.TabsAddingPage" %>
<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <script type="text/javascript">
        var getTasks = function (tree) {
            var msg = [],
                selNodes = tree.getChecked();
            Ext.each(selNodes, function (node) {
                if (msg.length > 0) {
                    msg.push(";");
                }

                msg.push(node.text);
            });

            return msg.join("");
        };
    </script>
</head>
<body>
    <form id="form1" runat="server">
     <ext:ResourceManager ID="ResourceManager1" runat="server" />
      <ext:ToolTip ID="tooltipForRole" 
            runat="server" 
            Target="ddfRole" 
            Html="<table><tr><td>设置对应角色只能查看对应页签.</td></tr></table>" 
            Title="角色内容" 
            AutoHide="false" 
            Closable="true"
            Draggable="true"
             Shadow="Sides"
            />
    <ext:Window 
            ID="TabsAddingWindow" 
            runat="server" 
            Closable="false"
            Resizable="false"
            Height="200" 
            Icon="Application"
            Title="增加页签"
            Draggable="false"
            Width="350"
            Modal="false"
            BodyPadding="5"
            Padding="5"
            Layout="AnchorLayout" >
            <Items >
                <ext:TextField 
                    ID="txtTabName" 
                    runat="server"                     
                    FieldLabel="页签" 
                    AllowBlank="false"
                    BlankText="请输入页签."
                    Text=""
                    AnchorHorizontal="100%"
                    />

             <ext:DropDownField ID="ddfRole" runat="server" AnchorHorizontal="100%" TriggerIcon="SimpleArrowDown" FieldLabel="角色" AllowBlank="false" BlankText="请选角色.">
            <Component>
                <ext:TreePanel ID="tpRole" 
                    runat="server" 
                    Title="角色"
                    Icon="Accept"
                    Height="300"
                    Shadow="None"
                    UseArrows="true"
                    AutoScroll="true"
                    Animate="true"
                    EnableDD="true"
                    ContainerScroll="true"
                    RootVisible="false">
                    
                    <Buttons>
                        <ext:Button ID="Button1" runat="server" Text="Close">
                            <Listeners>
                                <Click Handler="#{ddfRole}.collapse();" />
                            </Listeners>
                        </ext:Button>
                    </Buttons>
                    
                    <Listeners>
                        <CheckChange Handler="this.dropDownField.setValue(getTasks(this), false);" />
                    </Listeners>
                          
                 </ext:TreePanel>
            </Component>
            <Listeners>
                <Expand Handler="this.component.getRootNode().expand(true);" Single="true" Delay="10" />
            </Listeners>
        </ext:DropDownField>

            </Items>
            <Buttons>
                <ext:Button ID="btnSave" runat="server" Text="保存" Icon="Accept">
                    <Listeners>
                        <Click Handler="
                            if (!#{txtTabName}.validate() || !#{ddfRole}.validate()) {
                                Ext.Msg.alert('Error','请填写必要内容.');
                                // return false to prevent the btnLogin_Click Ajax Click event from firing.
                                return false; 
                            }" />
                    </Listeners>
                    <DirectEvents>
                        <Click OnEvent="btnSave_Click">
                            <EventMask ShowMask="true" Msg="保存中..." MinDelay="500" />
                        </Click>
                    </DirectEvents>
                </ext:Button>
                <ext:Button ID="btnCancel" runat="server" Text="Cancel" Icon="Decline">
                    
                </ext:Button>
            </Buttons>
            
        </ext:Window>
    </form>
</body>
</html>
